﻿using System.Linq;
using System.Windows;
using WordStat.Anylize;

namespace WordStat.Tasks
{
    public partial class TasksWindow : Window
    {
        private TaskService _taskService;

        internal TasksWindow(TaskService taskService)
        {
            InitializeComponent();

            _taskService = taskService;

            _dataGrid.DataContext = _taskService.TaskList;
        }

        private void _closeBtn_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void _retrieveTasksBtn_Click(object sender, RoutedEventArgs e)
        {
            _taskService.RetrieveTasks();

            _dataGrid.DataContext = _taskService.TaskList;
        }

        private void _startAnalyzingBtn_Click(object sender, RoutedEventArgs e)
        {
            _taskService.PerformTask();
        }
    }
}
